import time
from selenium.webdriver.common.by import By
from common.base import Base
from common.functions import open_browser


class BackLoginPage(Base):
    back_login_url = 'http://139.129.26.163/admin/'

    def input_username(self, username):
        self.base_send_keys((By.NAME, 'username'), username)

    def input_password(self, password):
        self.base_send_keys((By.NAME, 'password'), password)

    def remember(self):
        self.base_click((By.ID, 'remember'))

    def login_btn(self):
        self.base_click((By.CLASS_NAME, 'btn-a'))

    def quit(self):
        self.base_quit()


if __name__ == '__main__':
    driver = open_browser('chrome')
    back_login = BackLoginPage(driver)
    back_login.base_get('http://139.129.26.163/admin/')
    back_login.input_username('admin')
    back_login.input_password('admin123456')
    back_login.remember()
    back_login.login_btn()
